unit Unity_VerilenSiparisHar;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, Grids, Wwdbigrd, Wwdbgrid, StdCtrls, Buttons,
  ExtCtrls, Wwdotdot, Wwdbcomb, Mask, wwdbedit;

type
  TUnity_VerilenSiparisHarF = class(TForm)
    Panel2: TPanel;
    bkapat: TBitBtn;
    Panel1: TPanel;
    GroupBox3: TGroupBox;
    wwDBEdit6: TwwDBEdit;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Fisnok: TwwDBEdit;
    wwDBComboBox1: TwwDBComboBox;
    GroupBox2: TGroupBox;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    wwDBEdit3: TwwDBEdit;
    wwDBEdit4: TwwDBEdit;
    wwDBEdit5: TwwDBEdit;
    Grid1: TwwDBGrid;
    Siparis: TADOQuery;
    SiparisS: TDataSource;
    SiparisHar: TADOQuery;
    SiparisHarS: TDataSource;
    Label7: TLabel;
    wwDBEdit1: TwwDBEdit;
    Label3: TLabel;
    wwDBEdit2: TwwDBEdit;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure bkapatClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    SiparisID: integer;
  public
    { Public declarations }
  end;

var
  Unity_VerilenSiparisHarF: TUnity_VerilenSiparisHarF;

implementation

uses data, u_commonlogo;

{$R *.dfm}

procedure TUnity_VerilenSiparisHarF.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action := CaFree;
  Unity_VerilenSiparisHarF := nil;
end;

procedure TUnity_VerilenSiparisHarF.bkapatClick(Sender: TObject);
begin
  close;
end;

procedure TUnity_VerilenSiparisHarF.FormShow(Sender: TObject);
begin
  YerAyarla(Self, False);

  SiparisID := dm.islemid;

  Siparis.Close;
  Siparis.SQL.text :=
    'SELECT top 1 carikodu=(select CODE from LG_' + LGDON + '_CLCARD where LG_' + LGDON + '_CLCARD.LOGICALREF=LG_' + LGDON + '_01_ORFICHE.CLIENTREF),';
  Siparis.SQL.ADD('firmaadi=(select DEFINITION_ from LG_' + LGDON + '_CLCARD where LG_' + LGDON + '_CLCARD.LOGICALREF=LG_' + LGDON + '_01_ORFICHE.CLIENTREF),');
  Siparis.SQL.ADD('depoadi=(SELECT ADI FROM C_KULLAMBARLAR WHERE C_KULLAMBARLAR.KULLAMBAR=LG_' + LGDON + '_01_ORFICHE.SOURCEINDEX),');
  Siparis.SQL.ADD('FICHENO as siparisno,DATE_ as tarih,SPECODE,GENEXP1 as aciklama,DOCODE  FROM  LG_' + LGDON + '_01_ORFICHE');
  Siparis.SQL.add('where LOGICALREF=' + inttostr(SiparisID));
  Siparis.Open;

  Siparishar.Close;
  Siparishar.SQL.text :=
    'select CODE as stokkodu,NAME as cinsi,AMOUNT as miktar,PRICE,total FROM LG_' + LGDON + '_01_ORFLINE,LG_' + LGDON + '_ITEMS';
  Siparishar.SQL.add('WHERE LG_' + LGDON + '_01_ORFLINE.STOCKREF=LG_' + LGDON + '_ITEMS.LOGICALREF  AND ORDFICHEREF=' + inttostr(SiparisID));
  Siparishar.Open;
end;

procedure TUnity_VerilenSiparisHarF.FormKeyPress(Sender: TObject;
  var Key: Char);
begin
  if key = #27 then
  begin
    Close;
    key := #0;
  end;

end;

procedure TUnity_VerilenSiparisHarF.FormCreate(Sender: TObject);
begin
//  INTEGRATED OF LOGO
  siparis.Close;
  siparis.Sql.Text := '';
  siparis.Sql.ADD('SELECT top 1 carikodu=(select CODE from LG_' + LGDON + '_CLCARD where LG_' + LGDON + '_CLCARD.LOGICALREF=LG_' + LGDON + '_01_ORFICHE.CLIENTREF),');
  siparis.Sql.ADD('firmaadi=(select DEFINITION_ from LG_' + LGDON + '_CLCARD where LG_' + LGDON + '_CLCARD.LOGICALREF=LG_' + LGDON + '_01_ORFICHE.CLIENTREF),');
  siparis.Sql.ADD('depoadi=(SELECT ADI FROM C_KULLAMBARLAR WHERE C_KULLAMBARLAR.KULLAMBAR=LG_' + LGDON + '_01_ORFICHE.SOURCEINDEX),');
  siparis.Sql.ADD('FICHENO as siparisno,DATE_ as tarih,SPECODE,GENEXP1 as aciklama,DOCODE');
  siparis.Sql.ADD(' FROM  LG_' + LGDON + '_01_ORFICHE');
  siparis.Open;

  siparishar.Close;
  siparishar.Sql.Text := '';
  siparishar.Sql.ADD('select CODE as stokkodu,NAME as cinsi,AMOUNT as miktar,PRICE,total FROM LG_' + LGDON + '_01_ORFLINE,LG_' + LGDON + '_ITEMS WHERE LG_' + LGDON + '_01_ORFLINE.STOCKREF=LG_' + LGDON + '_ITEMS.LOGICALREF ');
  siparishar.Sql.ADD('AND ORDFICHEREF=1');
  siparishar.Open;
end;

end.

